﻿using System;
using System.Data;
using System.Collections.Generic;

using ElingOA6_DSJCJ.Model;
namespace ElingOA6_DSJCJ.BLL
{
	/// <summary>
	/// PaperAnswerManager
	/// </summary>
	public partial class PaperAnswerManager
	{
        private readonly ElingOA6_DSJCJ.DAL.PaperAnswerManager dal = new ElingOA6_DSJCJ.DAL.PaperAnswerManager();
		public PaperAnswerManager()
		{}
        #region 自增
        /// <summary>
        /// 分页获取文档列表
        /// <creator>fenghq</creator>
        /// <date>2013-02-28</date>
        /// </summary>
        /// <returns></returns>
        public List<Model.PaperAnswerManager> GetPaperListByPage(int pageSize, int pageIndex, string strWhere, string fOrderFiled, out int total)
        {
            DAL.PaperAnswerManager paperDAL = new DAL.PaperAnswerManager();
            return paperDAL.GetPaperListByPage(pageSize, pageIndex, strWhere, fOrderFiled, out total);
        }
        #endregion
        #region  Method
        /// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(decimal FPaperAnswerManagerID)
		{
			return dal.Exists(FPaperAnswerManagerID);
		}
        /// <summary>
        /// 是否存在该记录(根据ip和员工编号)
        /// </summary>
        public bool ExistsByIpAndEmplNo(string ipAddress, string emplNo, decimal paperId, string entityNo)
        {
            return dal.ExistsByIpAndEmplNo(ipAddress, emplNo, paperId, entityNo);
        }
        /// <summary>
        /// 是否存在该记录(根据ip)
        /// </summary>
        public bool ExistsByIp(string ipAddress, decimal paperId, string entityNo)
        {
            return dal.ExistsByIp(ipAddress, paperId, entityNo);
        }
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public decimal Add(ElingOA6_DSJCJ.Model.PaperAnswerManager model)
		{
			return dal.Add(model);
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(ElingOA6_DSJCJ.Model.PaperAnswerManager model)
		{
			return dal.Update(model);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(decimal FPaperAnswerManagerID)
		{
			
			return dal.Delete(FPaperAnswerManagerID);
		}
		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool DeleteList(string FPaperAnswerManagerIDlist )
		{
			return dal.DeleteList(FPaperAnswerManagerIDlist );
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public ElingOA6_DSJCJ.Model.PaperAnswerManager GetModel(decimal FPaperAnswerManagerID)
		{
			
			return dal.GetModel(FPaperAnswerManagerID);
		}



		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			return dal.GetList(strWhere);
		}
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			return dal.GetList(Top,strWhere,filedOrder);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<ElingOA6_DSJCJ.Model.PaperAnswerManager> GetModelList(string strWhere)
		{
			DataSet ds = dal.GetList(strWhere);
			return DataTableToList(ds.Tables[0]);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<ElingOA6_DSJCJ.Model.PaperAnswerManager> DataTableToList(DataTable dt)
		{
			List<ElingOA6_DSJCJ.Model.PaperAnswerManager> modelList = new List<ElingOA6_DSJCJ.Model.PaperAnswerManager>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				ElingOA6_DSJCJ.Model.PaperAnswerManager model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new ElingOA6_DSJCJ.Model.PaperAnswerManager();
					if(dt.Rows[n]["FPaperAnswerManagerID"]!=null && dt.Rows[n]["FPaperAnswerManagerID"].ToString()!="")
					{
						model.FPaperAnswerManagerID=decimal.Parse(dt.Rows[n]["FPaperAnswerManagerID"].ToString());
					}
					if(dt.Rows[n]["FPaperId"]!=null && dt.Rows[n]["FPaperId"].ToString()!="")
					{
						model.FPaperId=decimal.Parse(dt.Rows[n]["FPaperId"].ToString());
					}
					if(dt.Rows[n]["FEntityNo"]!=null && dt.Rows[n]["FEntityNo"].ToString()!="")
					{
					model.FEntityNo=dt.Rows[n]["FEntityNo"].ToString();
					}
					if(dt.Rows[n]["FEmplNo"]!=null && dt.Rows[n]["FEmplNo"].ToString()!="")
					{
					model.FEmplNo=dt.Rows[n]["FEmplNo"].ToString();
					}
					if(dt.Rows[n]["FDeptNo"]!=null && dt.Rows[n]["FDeptNo"].ToString()!="")
					{
					model.FDeptNo=dt.Rows[n]["FDeptNo"].ToString();
					}
					if(dt.Rows[n]["FAnswerDate"]!=null && dt.Rows[n]["FAnswerDate"].ToString()!="")
					{
					model.FAnswerDate=dt.Rows[n]["FAnswerDate"].ToString();
					}
					if(dt.Rows[n]["FIp"]!=null && dt.Rows[n]["FIp"].ToString()!="")
					{
					model.FIp=dt.Rows[n]["FIp"].ToString();
					}
					if(dt.Rows[n]["FSurverName"]!=null && dt.Rows[n]["FSurverName"].ToString()!="")
					{
					model.FSurverName=dt.Rows[n]["FSurverName"].ToString();
					}
					if(dt.Rows[n]["FSurverContact"]!=null && dt.Rows[n]["FSurverContact"].ToString()!="")
					{
					model.FSurverContact=dt.Rows[n]["FSurverContact"].ToString();
					}
					if(dt.Rows[n]["FSurverUnitName"]!=null && dt.Rows[n]["FSurverUnitName"].ToString()!="")
					{
					model.FSurverUnitName=dt.Rows[n]["FSurverUnitName"].ToString();
					}
					if(dt.Rows[n]["FSurverAddress"]!=null && dt.Rows[n]["FSurverAddress"].ToString()!="")
					{
					model.FSurverAddress=dt.Rows[n]["FSurverAddress"].ToString();
					}
					if(dt.Rows[n]["FSurverPostCode"]!=null && dt.Rows[n]["FSurverPostCode"].ToString()!="")
					{
					model.FSurverPostCode=dt.Rows[n]["FSurverPostCode"].ToString();
					}
					if(dt.Rows[n]["FSurverEMail"]!=null && dt.Rows[n]["FSurverEMail"].ToString()!="")
					{
					model.FSurverEMail=dt.Rows[n]["FSurverEMail"].ToString();
					}
					modelList.Add(model);
				}
			}
			return modelList;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetAllList()
		{
			return GetList("");
		}

		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			return dal.GetRecordCount(strWhere);
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			return dal.GetListByPage( strWhere,  orderby,  startIndex,  endIndex);
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		//{
			//return dal.GetList(PageSize,PageIndex,strWhere);
		//}

		#endregion  Method
	}
}

